package com.zq.create.factory_method;

public interface Phone {
    void call();
}

class MiPhone implements Phone {

    public static class MiPhoneFactory implements PhoneFactory {
        @Override
        public MiPhone newInstance() {
            return new MiPhone();
        }
    }

    private MiPhone() {}

    @Override
    public void call() {
        System.out.println("The brand of this phone is 'MI'.");
    }
}

class IPhone implements Phone {

    public static class IPhoneFactory implements PhoneFactory {
        @Override
        public IPhone newInstance() {
            return new IPhone();
        }
    }

    private IPhone() {}

    @Override
    public void call() {
        System.out.println("The brand of this phone is 'APPLE'.");
    }
}
